﻿using AutoWelding.Utils;

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace AutoWelding.Views.Visual
{
    public partial class VisualForm_副本 : Form
    {
        private EmbeddedExeTool exeTool;
        public VisualForm_副本()
        {
            InitializeComponent();
            SetupForm();
        }

        /// <summary>
        /// 加载 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void VisualForm_副本_Load(object sender, EventArgs e)
        {
            try
            {
                string path = Application.StartupPath + "\\outTools\\mbslave.exe";
                exeTool = new EmbeddedExeTool();
                exeTool.LoadEXE(this, path); // 注意：这里传入this而不是panel
            }
            catch (Exception ex)
            {
                LogHelper.Error(this.GetType(), "加载外部程序异常", ex);
                MessageBox.Show(ex.Message);
            }
        }

        private void SetupForm()
        {
            // 设置窗体样式
            this.FormBorderStyle = FormBorderStyle.SizableToolWindow; // 工具窗口样式
            this.TopMost = true; // 置顶
            this.StartPosition = FormStartPosition.Manual;
            this.Location = new Point(100, 100); // 初始位置
            this.Size = new Size(800, 600); // 窗体大小

            // 可选：无边框样式
            // this.FormBorderStyle = FormBorderStyle.None;
        }
    }
}
